//
//  FLButton.m
//  BaseRepo
//
//  Created by leo on 2018/8/8.
//  Copyright © 2018年 LEO. All rights reserved.
//

#import "FLButton.h"


@implementation FLButton


+ (FLButton *(^)(UIButtonType))fl_buttonWithType {
    return ^(UIButtonType type){
        FLButton *button = [FLButton buttonWithType:type];
        return button;
    };
}

- (FLButton *(^)(CGRect))fl_frame {
    return ^(CGRect frame) {
        self.frame = frame;
        return self;
    };
}

- (FLButton *(^)(NSString *))fl_normalTitle {
    return ^(NSString *title){
        [self setTitle:title forState:UIControlStateNormal];
        return self;
    };
}


- (FLButton *(^)(UIColor *))fl_normalTitleColor {
    return ^(UIColor *color) {
        [self setTitleColor:color forState:UIControlStateNormal];
        return self;
    };
}

- (FLButton *(^)(UIImage *))fl_normalImage {
    return ^(UIImage *image){
        [self setImage:image forState:UIControlStateNormal];
        return self;
    };
}

- (FLButton *(^)(UIImage *))fl_normalBgImage {
    return ^(UIImage *image) {
      
        [self setBackgroundImage:image forState:UIControlStateNormal];
        return self;
    };
}


- (FLButton *(^)(NSString *))fl_selectedTitle {
    return ^(NSString *title){
        [self setTitle:title forState:UIControlStateSelected];
        return self;
    };
}


- (FLButton *(^)(UIColor *))fl_selectedTitleColor {
    return ^(UIColor *color) {
        [self setTitleColor:color forState:UIControlStateSelected];
        return self;
    };
}

- (FLButton *(^)(UIImage *))fl_selecetedImage {
    return ^(UIImage *image){
        [self setImage:image forState:UIControlStateSelected];
        return self;
    };
}

- (FLButton *(^)(UIImage *))fl_selectedBgImage {
    return ^(UIImage *image) {
        
        [self setBackgroundImage:image forState:UIControlStateSelected];
        return self;
    };
}

- (FLButton *(^)(id, SEL))fl_touchUpInsideEvent {
    return ^(id target, SEL selector){
        [self addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
        return self;
    };
}

- (FLButton *(^)(UIColor *))fl_bgColor {
    return ^(UIColor *color){
        self.backgroundColor = color;
        return self;
    };
}
@end
